/**
 ******************************************************************************
 * @file    timeouts.h
 * @author  jobs
 * @version v0.00
 * @date    2020-04-18 21:34
 * @brief
 * @note
 *
 ******************************************************************************
 */


#ifndef APP_TIMEOUTS_H_
#define APP_TIMEOUTS_H_

#include <stdint.h>

typedef void (* cyclic_timer_handler)(void);

struct cyclic_timer {
  uint32_t interval_ms;
  cyclic_timer_handler handler;
};

extern const struct cyclic_timer cyclic_timers[];

extern const int num_cyclic_timers;

typedef void (*sys_timeout_handler)(void *arg);
struct sys_timeo
{
	struct sys_timeo *next;
	uint32_t time;
	sys_timeout_handler h;
	void *arg;
};

void sys_timeouts_init(void);
void sys_timeout(uint32_t msecs, sys_timeout_handler handler, void *arg);
void sys_check_timeouts(void);
void cyclic_timer(void *arg);


#endif /* APP_TIMEOUTS_H_ */
